JS传递参数和接收参数

<a href="javascript:" id="1">传递</A>
如何能把上面这个

id =1

用JS传递出去呢?
然后用JS接收呢?
这个应该怎么写代码呢?
都是在当前页面完成的。。那个是一个弹出一个窗口。。但是弹出窗口中我想要可以传递那个ID 并且接收到

var timer = null;
var offset = 5000;
var index = 0; /* -1第一个,0第二个... */

//大图交替轮换
function slideImage(i){
var id = 'image_'+ target[i];
$('#'+ id).animate({opacity: 1}, 400).show().siblings('.image').animate({opacity: 0}, 400).hide();
}
//bind thumb a
function hookThumb(){
$('#thumbs li a').bind('click', function(){
if (timer) {
clearTimeout(timer);
}
var id = this.id;
index = getIndex(id.substr(6));
rechange(index);
slideImage(index);
timer = window.setTimeout(offset);
this.blur();
return false;
});
}

function bighookBtn(){
$('.item-left p span').filter('#big_play_prev,#big_play_next').bind('click', function(){
if (timer){
clearTimeout(timer);
}
var id = this.id;
if (id == 'big_play_prev') {
index--;
if (index < 0) index = 4;
}else{
index++;
if (index > 4) index = 0;
}
rechange(index);
slideImage(index);
timer = window.setTimeout(offset);
});
}

//get index
function getIndex(v){
for(var i=0; i < target.length; i++){
if (target[i] == v) return i;
}
}

function rechange(loop){
var id = 'thumb_'+ target[loop];
$('#thumbs li a.current').removeClass('current');
$('#'+ id).addClass('current');
}

$(function(){
hookThumb();
bighookBtn();

$('.items a').click(function(){
$('#layer').show('slow');
});
$('.close').click(function(){
$('#layer').hide('slow');
});

});

这是我原来的弹出窗口JS

下面的代码没看
===============
给你个演示
<a href="javascript:show(this)" id="1">传递</A>
-------------------
function show(obj){
alert(obj);//会弹出object
alert(obj.id);//会弹出1,这个id就是指a中的id
}
或是
<a href="javascript:show(this.id)" id="1">传递</A>
-------------------
function show(str){
alert(str);//会弹出1,这个id就是指a中的id
}追问

我用你的方法 2个都试了 他只会弹出 undefined 这个英文出来!

温馨提示:答案为网友推荐,仅供参考