2009-04-16 134 views
3

任何人都可以帮我完成我的项目吗?我将如何能够在JavaScript中调用textfield细节?Javascript变量传递

function AddPushpin() 
{ 
    var shape = new VEShape(VEShapeType.Pushpin, map.GetCenter()); 
    shape.SetTitle(**//it should be coming from a textfield//**); 
    shape.SetDescription('This is shape number '+pinid); 
    pinid++; 
    map.AddShape(shape); 
} 

回答

4

的document.getElementById( 'myTextElementsId')。值

3
<textfield id="shapeTitle"></textfield> 

---- // ----- 

document.getElementById('shapeTitle').value 

其中 'shapeTitle' 应该对应于所需的值的元素的ID。

+0

有没有可能通过这个上传例如图片? 我的意思是,这是相同的代码? – bluestella 2009-04-16 09:51:23