Home > Web Front-end > HTML Tutorial > document.getElementByIdx('contents').src=para does not work. Please check if I am doing this right? _html/css_WEB-ITnose

document.getElementByIdx('contents').src=para does not work. Please check if I am doing this right? _html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-24 11:55:12
Original
1383 people have browsed it




 Ato Processor D2000 and N2000 Series











 

  
 var n=self.location.href.indexOf("?")  
 if(n>0)   
  {    
  var para=self.location.href.substr(n 1)   
  document.getElementByIdx("contents").src=para
  }
 
 

我想要根据url传递的参数来设置frame的源


回复讨论(解决方案)

url 带问号吗
alert( para)看下这个是不是你要的

带问号的 url为file:////home/wangcb/htmlc/main.html?main-html.html#1

带问号的 url为file:////home/wangcb/htmlc/main.html?main-html.html#1


var para=String(self.location.href).substr(n 1)   

还是没用呀 按你的改了还是没效果 蛋疼

还是没用呀 按你的改了还是没效果 蛋疼


 var n=self.location.href.indexOf("?")  
 if(n>0)   
  {    
  var para=self.location.href.substr(n 1)   
  document.getElementById("contents").src=para
  }

??这没区别把???

??这没区别把???

getElementById 写错了




Series





 

   
  document.getElementById("contents").src="http://www.sina.com"


这样也不行 ,,你复制下来跑跑




Series








like this It doesn’t work, you can copy it and run it


The script code after the tag will not be executed

 <!DOCTYPE html> <html> <head> <title>Series</title><script type="text/javascript">window.onload = function (){document.getElementById("contents").src="http://www.sina.com"}</script> </head> <frameset cols="350,*"> <frame id="links" class="links" name="links" src=""/> <frame id="contents" class="contents" name="contents" src="" /> </frameset>  </html> 
Copy after login

The 9th floor is the correct answer. Thank you very much.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template