
jsp中
<tr>
<th align="left" width="20%" style="width: 170px; ">分享文案编辑:</th>
</tr>
<tr>
<td class="form_table_content" ><input name="wshopshare"
id="wshopshare_1" type="text" style="width: 440px; ">
</td>
<td><input type="button" onclick="componentaddshare();" id="addshare" value="添加">
</td>
</tr>
点击一次添加按钮页面多一个文本框
————————————————————————————————————————
JS中
$("#content1")
append(
'<table id="1_'//id=1_type
+ type
+ '"><tr><td>分享语句'
+ type
+ '</td></tr><tr>'
+ '<td><div id="wshopshare"></div></td>'
+ '<td><input name="wshopshare" id="wshopshare" type="text" style="width: 440px; "></td>'
+ '<td></td>'
+ '<td><button type="button" id="del1" onclick="componentdeleteAll(\'1\');">删除</button></td>'
+ '</tr></table>');
新建两个窗口,一个父窗口,一个子窗口。
_复翱诨袢∽哟翱谟辛街址椒ǎ谝恢址椒ㄊ牵好扛龆加幸桓_ontentWindow属性, 通过contentWindow可获取子窗口;第二种方法是:window对象有frames属性,它是一个类数组对象,可以通过数字或窗体名进行索引。
_庋胝夷歉龃翱诰涂梢灾付ㄕ夷歉龃翱诹恕
方法一:
<style>
img{
width:50%;
height:50%
}
</style>
<img src=1PNG onclick="lookimg(thissrc)">
<script>
function lookimg(str)
{
var newwin=windowopen()
newwindocumentwrite("<img src="+str+" />")
}
</script>
方法二:
<img src=1png onclick="lookimg(thissrc)">
<script>
function lookimg(str)
{
var newwin=windowopen()
myimg=newwindocumentcreateElement("img")
myimgsrc=str
newwindocumentbodyappendChild(myimg)
}
</script>
您好,HTML5规范文档中指出:如果一个元素符合下面两条规则中的任一条,则window对象中必须要有与之对应的一个属性,属性值就是这个对象
如果一个元素拥有ID属性,那么ID属性的属性值就会成为window对象的属性名
如果一个元素拥有name属性,那么name属性的属性值就会成为window对象的属性名但这个元素的标签名必须是: a, applet, area, embed, form, frame, frameset, iframe, img, object,其中的一个。
> "foo" in window
false
> typeof foo // 这个全局变量到底有木有
object
//错误控制台输出了下面的警告//Element referenced by ID/NAME in the global scope
//Use W3C standard documentgetElementById() instead
> foo
[object HTMLDivElement]
//错误控制台输出了下面的警告//Element referenced by ID/NAME in the global scope
//Use W3C standard documentgetElementById() instead> "foo" in window true
以上就是关于如何通过jquery获取js动态append到html页面的dom属性全部的内容,包括:如何通过jquery获取js动态append到html页面的dom属性、js多个窗口如何获取指定窗口、javascript:点击图片打开新窗口浏览图片等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)