2009-04-16 132 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