English 中文(简体)
窗口问题
原标题:window.location problem

我正面临ie问题。

当有人使用窗户时。 除电灯6外,所有浏览器都用上了罚款。

它在第6类中工作,如果说:

<a href="javascript:void(0);" onclick="javascript:window.location( http://www.demo.com );">demo</a>

但它没有按以下编码开展工作。

<a href="javascript:void(0);" onclick="javascript:redirect();>demo</a>
function redirect()
{
  window.location( http://www.demo.com );"
}

请指出这里的问题。

感谢。

Avinash

问题回答

<编码>javascript: protocol is only used if You have Javascript Code in an URL. 如果你把它放在一个事件的手里,那就成了一个标签。

href 财产,以改变地点。

你在该职能中的编码线之后有额外的引证标记,这可能会造成yn误。

<a href="javascript:void(0);" onclick="redirect();>demo</a>

<script type="text/javascript">
function redirect() {
  window.location.href =  http://www.demo.com ;
}
</script>

如何做到这一点:

<a href="#" onclick="redirect(); return false;">
  demo
</a>

如果您希望该网页转至demo.html。 当用户点击链接时,Dafre我建议你使用通用的交叉浏览器<a href=“demo.html”>demo</a>?

Try:

window.location.href =  http://www.demo.com ;

职能部门。

Try:

window.event.returnValue = false; document.location.href= http://www.demo.com ;





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签