René's URL Explorer Experiment


Title: 【JavaScript】【学习心得】学习 JavaScript 第六天 · Issue #10 · paddingme/Learning-JavaScript · GitHub

Open Graph Title: 【JavaScript】【学习心得】学习 JavaScript 第六天 · Issue #10 · paddingme/Learning-JavaScript

X Title: 【JavaScript】【学习心得】学习 JavaScript 第六天 · Issue #10 · paddingme/Learning-JavaScript

Description: 动态创建标记 一些传统方法 document.write 为什么不使用 document.write? document.write 的最大缺点是它违背了“行为应该与结构分离”的原则。 MIME 类型 application/xhtml+xml 与之不兼容,不会被执行。 innerHTML 属性 支持读取和写入。 DOM 方法 createElement 方法 document.createElement(nodeName); appendChild 方法 parent...

Open Graph Description: 动态创建标记 一些传统方法 document.write 为什么不使用 document.write? document.write 的最大缺点是它违背了“行为应该与结构分离”的原则。 MIME 类型 application/xhtml+xml 与之不兼容,不会被执行。 innerHTML 属性 支持读取和写入。 DOM 方法 createElement 方法 document.create...

X Description: 动态创建标记 一些传统方法 document.write 为什么不使用 document.write? document.write 的最大缺点是它违背了“行为应该与结构分离”的原则。 MIME 类型 application/xhtml+xml 与之不兼容,不会被执行。 innerHTML 属性 支持读取和写入。 DOM 方法 createElement 方法 document.create...

Opengraph URL: https://github.com/paddingme/Learning-JavaScript/issues/10

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"【JavaScript】【学习心得】学习 JavaScript 第六天","articleBody":"# 动态创建标记\n## 一些传统方法\n### `document.write`\n\n为什么不使用 `document.write`?\n\n`document.write` 的最大缺点是它违背了“行为应该与结构分离”的原则。\nMIME 类型 application/xhtml+xml 与之不兼容,不会被执行。\n### `innerHTML` 属性\n\n支持读取和写入。\n## DOM 方法\n### `createElement` 方法\n\n``` javascript\n    document.createElement(nodeName);\n```\n### `appendChild` 方法\n\n``` javascript\n    parent.appendChild(child);\n```\n### `createTextNode` 方法\n\n``` javascript\n    document.createTextNode(text);\n```\n### 在已有元素前插入一个新元素\n\n``` javascript\n    parentElement.insertBefore(newElement,tagetElement);\n```\n\n我们不必关心父元素到底是谁,因为 targetElement 的 parentNode 就是。\n\n``` javascript\n    var gallery = document.getElementById(\"gallery\");\n    gallery.parentNode.insertBefore(\"p\",gallery);\n```\n### 在现有元素后插入一个新元素\n\n``` javascript\n    function insertAfter(newElement,targetElement){\n        var parent = targetElement.parentNode;\n        if(parent.lastChild == targetElement){\n            parent.appendChild(newElement);\n        } else {\n            parent.insertBefore(newElement,targetElement.nextSibling);\n        }\n    }\n```\n\n为了更好做到行为结构表现分离,我们应该去掉在上篇文章我们的代码结构中的\n\n```\n\u003cimg id=\"placeholder\"  src=\"images/codercat.jpg\" alt=\"\"\u003e\n\u003cp id=\"decription\"\u003e请选择一张图片\u003c/p\u003e\n```\n\n让我们来动态创建它们。下面是完成的代码,仔细体会实现下。\n\n``` html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"zh-cmn-Hans\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003ctitle\u003e1-4 案例研究: JavaScript 图片库\u003c/title\u003e\n    \u003cstyle\u003e\n\n        body {\n           margin: 1em 10%;\n           color: #333;\n           background-color: #ccc;\n           font-family: \"Helvetica\",\"Arial\",serif;\n        }\n\n        h1 {\n            color: #333;\n            background-color: rgba(0, 0, 0, 0);\n        }\n\n        a {\n            color: #c60;\n            background-color: rgba(0, 0, 0, 0);\n            font-weight: bold;\n            text-decoration: none;\n        }\n\n        ul {\n            padding: 0;\n        }\n\n        li {\n            float: left;\n            padding: 1em;\n            list-style-type: none;\n        }\n\n        img {\n            display: block;\n            clear: both;\n            width: 424px;\n            height: 424px;\n            border: 1px solid #ccc;\n        }\n    \u003c/style\u003e\n\n\u003c/head\u003e\n\n\u003cbody\u003e\n    \u003ch1\u003eSnapshots\u003c/h1\u003e\n    \u003cul id=\"image-gallery\"\u003e\n        \u003cli\u003e\n            \u003ca href=\"images/codercat.jpg\"  title=\"This is codercat.jpg.\"\u003ecodercat\u003c/a\u003e\n        \u003c/li\u003e\n        \u003cli\u003e\n            \u003ca href=\"images/inspectocat.jpg\" title=\"This is inspectocat.jpg.\"\u003einspectocat\u003c/a\u003e\n        \u003c/li\u003e\n        \u003cli\u003e\n            \u003ca href=\"images/maxtocat.gif\" title=\"This is maxtocat.gif.\"\u003emaxtocat\u003c/a\u003e\n        \u003c/li\u003e\n        \u003cli\u003e\n            \u003ca href=\"images/yaktocat.png\" title=\"This is yaktocat.png.\"\u003eyaktocat\u003c/a\u003e\n        \u003c/li\u003e\n        \u003cli\u003e\n            \u003ca href=\"images/octobiwan.jpg\" title=\"This isoctobiwan.jpg.\"\u003eoctobiwan\u003c/a\u003e\n        \u003c/li\u003e\n    \u003c/ul\u003e\n\u003cscript src=\"1-7.js\"\u003e\u003c/script\u003e\n\u003c/body\u003e\n```\n\n``` javascript\nfunction addLoadEvent(func) {\n    var oldonload = window.onload;\n    if (typeof oldonload != 'function') {\n        window.onload = func;\n    } else {\n        window.onload = function() {\n            oldonload();\n            func();\n        }\n    }\n}\n\nfunction insertAfter(newElement, targetElement) {\n    var parent = targetElement.parentNode;\n    if (parent.lastChild == targetElement) {\n        parent.appendChild(newElement);\n    } else {\n        parent.insertBefore(newElement, targetElement.nextSlibing);\n    }\n}\n\nfunction preparePlaceholder() {\n    if (!document.createElement) return false;\n    if (!document.createTextNode) return false;\n    if (!document.getElementById) return false;\n    if (!document.getElementById(\"image-gallery\")) return false;\n    var placeholder = document.createElement(\"img\");\n    placeholder.setAttribute(\"id\", \"placeholder\");\n    placeholder.setAttribute(\"src\", \"images/codercat.jpg\");\n    placeholder.setAttribute(\"alt\", \"my image gallery\");\n\n    var description = document.createElement(\"p\");\n    description.setAttribute(\"id\", \"description\");\n    var desctext = document.createTextNode(\"choose an image\");\n    description.appendChild(desctext);\n\n    var gallery = document.getElementById(\"image-gallery\");\n    insertAfter(placeholder,gallery);\n    insertAfter(description,gallery);\n}\n\nfunction prepareGallery() {\n    if (!document.getElementsByTagName) return false;\n    if (!document.getElementById) return false;\n    if (!document.getElementById(\"image-gallery\")) return false;\n\n    var gallery = document.getElementById(\"image-gallery\");\n    var links = gallery.getElementsByTagName(\"a\");\n    for (var i = 0; i \u003c links.length; i++) {\n        links[i].onclick = function() {\n            return showPic(this);\n        }\n        links[i].onkeypress = links[i].onclick;\n    }\n}\n\nfunction showPic(whichpic) {\n    if (!document.getElementById(\"placeholder\")) return false;\n    var source = whichpic.getAttribute(\"href\");\n    placeholder.setAttribute(\"src\", source);\n\n    if (!document.getElementById(\"description\")) return false;\n    if (whichpic.getAttribute(\"title\")) {\n        var text = whichpic.getAttribute(\"title\");\n    } else {\n        var text = \"\";\n    }\n\n    var description = document.getElementById(\"description\");\n    if (description.firstChild.nodeType == 3) {\n        description.firstChild.nodeValue = text;\n    }\n    return false;\n}\n\naddLoadEvent(preparePlaceholder);\naddLoadEvent(prepareGallery);\n```\n\ndemo:[codepen](http://codepen.io/paddingme/pen/jEERab)\n## AJAX\n\nAJAX 依赖 JavaScript, 故可能有浏览器不支持他,而搜索引擎的蜘蛛程序也不会抓取到有关内容。\n\nAJAX 技术的核心是 XMLHttpRequest 对象。\n","author":{"url":"https://github.com/paddingme","@type":"Person","name":"paddingme"},"datePublished":"2014-11-22T15:07:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/10/Learning-JavaScript/issues/10"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:fce67e8f-6379-f499-2ee6-b6a1f03207e2
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA140:1F3A16:34B7A79:488BD6B:6A60D648
html-safe-nonceb1ffed07f56a0ce5ac5d70a70521cb5680eaa194ed1dd240eb42690a7009a86f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMTQwOjFGM0ExNjozNEI3QTc5OjQ4OEJENkI6NkE2MEQ2NDgiLCJ2aXNpdG9yX2lkIjoiMzU1OTU3NzUxMjY5MDM3NDIxNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf7be746c6d0f22ddc7acc54346d95b41a5940a0e33aa7919b2ba84e164124307
hovercard-subject-tagissue:49794022
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/paddingme/Learning-JavaScript/10/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0d7519e89d377bea5b9c5b2d99ed5c0bd08ca5a46927edd403d3ad6c9b810a77/paddingme/Learning-JavaScript/issues/10
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0d7519e89d377bea5b9c5b2d99ed5c0bd08ca5a46927edd403d3ad6c9b810a77/paddingme/Learning-JavaScript/issues/10
og:image:alt动态创建标记 一些传统方法 document.write 为什么不使用 document.write? document.write 的最大缺点是它违背了“行为应该与结构分离”的原则。 MIME 类型 application/xhtml+xml 与之不兼容,不会被执行。 innerHTML 属性 支持读取和写入。 DOM 方法 createElement 方法 document.create...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepaddingme
hostnamegithub.com
expected-hostnamegithub.com
None025e511fb0e6dd11aaa36892212f7bcc13708244bc2bcbeff1cf34fc77723812
turbo-cache-controlno-preview
go-importgithub.com/paddingme/Learning-JavaScript git https://github.com/paddingme/Learning-JavaScript.git
octolytics-dimension-user_id5771087
octolytics-dimension-user_loginpaddingme
octolytics-dimension-repository_id25473884
octolytics-dimension-repository_nwopaddingme/Learning-JavaScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id25473884
octolytics-dimension-repository_network_root_nwopaddingme/Learning-JavaScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release405b1f59618e9c5e102e2408c26ce58f1937fbca
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/paddingme/Learning-JavaScript/issues/10#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpaddingme%2FLearning-JavaScript%2Fissues%2F10
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpaddingme%2FLearning-JavaScript%2Fissues%2F10
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=paddingme%2FLearning-JavaScript
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/10
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/10
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/10
paddingme https://github.com/paddingme
Learning-JavaScripthttps://github.com/paddingme/Learning-JavaScript
Notifications https://github.com/login?return_to=%2Fpaddingme%2FLearning-JavaScript
Fork 13 https://github.com/login?return_to=%2Fpaddingme%2FLearning-JavaScript
Star 28 https://github.com/login?return_to=%2Fpaddingme%2FLearning-JavaScript
Code https://github.com/paddingme/Learning-JavaScript
Issues 30 https://github.com/paddingme/Learning-JavaScript/issues
Pull requests 0 https://github.com/paddingme/Learning-JavaScript/pulls
Actions https://github.com/paddingme/Learning-JavaScript/actions
Projects https://github.com/paddingme/Learning-JavaScript/projects
Wiki https://github.com/paddingme/Learning-JavaScript/wiki
Security and quality 0 https://github.com/paddingme/Learning-JavaScript/security
Insights https://github.com/paddingme/Learning-JavaScript/pulse
Code https://github.com/paddingme/Learning-JavaScript
Issues https://github.com/paddingme/Learning-JavaScript/issues
Pull requests https://github.com/paddingme/Learning-JavaScript/pulls
Actions https://github.com/paddingme/Learning-JavaScript/actions
Projects https://github.com/paddingme/Learning-JavaScript/projects
Wiki https://github.com/paddingme/Learning-JavaScript/wiki
Security and quality https://github.com/paddingme/Learning-JavaScript/security
Insights https://github.com/paddingme/Learning-JavaScript/pulse
【JavaScript】【学习心得】学习 JavaScript 第六天https://github.com/paddingme/Learning-JavaScript/issues/10#top
Mu-Help-Planhttps://github.com/paddingme/Learning-JavaScript/issues?q=state%3Aopen%20label%3A%22Mu-Help-Plan%22
https://github.com/paddingme
paddingmehttps://github.com/paddingme
on Nov 22, 2014https://github.com/paddingme/Learning-JavaScript/issues/10#issue-49794022
codepenhttp://codepen.io/paddingme/pen/jEERab
Mu-Help-Planhttps://github.com/paddingme/Learning-JavaScript/issues?q=state%3Aopen%20label%3A%22Mu-Help-Plan%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.