小编Ove*_*ked的帖子

在img中调用onclick?

我有几个拇指指甲,我想点击它,并在缩略图上弹出一个更大的版本.我有我正在使用的代码,如果我在标签中将其设置为链接,它可以工作,但我似乎无法使thumbanail img本身可以使用

HTML,链接有效

 <li><a href="#" onclick="toggle('widget1')">Toggle</a></li>
Run Code Online (Sandbox Code Playgroud)

的javaScript

function toggle(id) {
  var e = document.getElementById(id);

  if (e.style.display == '')
    e.style.display = 'none';
  else
    e.style.display = '';
}
Run Code Online (Sandbox Code Playgroud)

HTML图像我想点击这里是我尝试过的

<div id="wid1"><a href="#" onclick="toggle('widget1')"><img src="widLayOut1.jpg"   
height="200" width="200" /></a></div>
Run Code Online (Sandbox Code Playgroud)

其余的HTML

<div id="widget1" style="display:none"><img src="widget1.jpg" /></div>
enter code here
Run Code Online (Sandbox Code Playgroud)

思考

javascript css

3
推荐指数
1
解决办法
168
查看次数

是否可以在警报框中加载图片?

我正试图将图片加载到一个警告框中,但我得到 "[object HTMLImageElement]"的图片应该在哪里.

这就是我所拥有的:

 function joePic(){
 var joe_fat = new Image;
 joe_fat.src = "pic1.jpg";
 alert (joe_fat);
 }

 <input type="button" value="Click here it find out" name="joePhoto" onclick="joePic()" 
 height="150" width="150" />
Run Code Online (Sandbox Code Playgroud)

这可能吗?

javascript

1
推荐指数
1
解决办法
2924
查看次数

javaScript时髦的cookie?

当我尝试读取我设置的cookie时,似乎不对

这是我的cookie功能

function readCookie(){
if (document.cookie !=""){
    document.getElementsByName("eMail").innerHTML = alert("hello, " +    
document.cookie.split("=")[1]);
}
}

//for setting cookies
function writeCookie(cName, cValue, expDate, cPath, cDomain, cSecure){
if(cName && cValue!= ""){
var cString = cName + " = " + escape(cValue);

if (expDate) cString += ";expires=" + expDate,toGMString();
if (cPath) cString += ";path=" + cPath;
if (cDomain) cString += ";domain=" + cDomain;
if (cSecure) cString += ";secure";

document.cookie = cString;
}
}
Run Code Online (Sandbox Code Playgroud)

饼干被设置

 <input type="submit" value="Submit"     
onclick="writeCookie('userId',document.getElementsByName('eMail').value)"/>
Run Code Online (Sandbox Code Playgroud)

警报框

hello, undefined;__utma
Run Code Online (Sandbox Code Playgroud)

想到这意味着什么?

javascript

1
推荐指数
1
解决办法
140
查看次数

让声明的命名空间生效

我试图在外部CSS(实际上是两个单独的文件)中编写名称空间.当我在浏览器上运行该文件时,它将不使用声明的命名空间.我认为该文件正在调用css文件,但它没有应用命名空间样式

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?xml version="1.0" encoding="utf-8"?>


<html xmlns:act="http://www.superstarmovies.com/actors" 
  xmlns:mov="http://www.superstarmovies.com/movies"
  xmlns="http://www.w3.org/1999/xhtml" >

<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<title>Superstar Movies: Stars of the Month</title>
<link rel="stylesheet" href="movies.css"  type="text/css" ?>
<link rel="stylesheet" href="actors.css" type="text/css" ?>
<link rel="stylesheet" href="superstar.css" type="text/css" />
</head>

<body>
<div id="heading"><img src="logo.gif" alt="Superstar Movies" /></div>

<div id="main">
<h1>Stars of the Month</h1>
<h3>Movies by Our Featured Stars!</h3>
<act:actors>

    <act:actor>
        <act:name>Halle Berry</act:name>
    <act:date>August 14, 1966</act:date>
    <act:birthplace>Cleveland, Ohio</act:birthplace>
          <mov:movie genre="action" star="Halle Berry">
        <mov:name>Catwoman</mov:name>
    <mov:date>(2004)</mov:date>
    <mov:length>104 …
Run Code Online (Sandbox Code Playgroud)

html css xml xhtml xml-namespaces

1
推荐指数
1
解决办法
830
查看次数

标签 统计

javascript ×3

css ×2

html ×1

xhtml ×1

xml ×1

xml-namespaces ×1