function showMe(e)"> function showMe(e)"> function showMe(e)" />

ikkita uskuna ikki document.write qiymatlarini almashtiring

Quyidagi JavaScript-ni http://www.google.co.uk/webhp?hl=en o'rniga http://link-ads.blogspot.com/?url=http % 3A% 2F% 2Fwww.google.co.uk% 2Fwebhp% 3Fhl% 3Den kiritilgan.

<script type="text/javascript">
function showMe(e) {
paramencode = encodeURIComponent(e.value)
document.write('http://link-ads.blogspot.com/?url='+paramencode+'');
}
</script>
<input type="text" id="foo" placeholder="URL here" onchange="showMe(this)" />

It works fine but I now need to inclue an &name= + value inherited from second input to the end of the document write ie.

document.write('http://link-ads.blogspot.com/?url='+paramencode+'&name='+andnameinput+'');

where '+andnameinput+' will inherit the values from a second <input>

EDITED if i insert http://www.google.co.uk/webhp?hl=en into the first input

<input type="text" id="foo" placeholder="URL here"/>

the output from the document.write should be http://link-ads.blogspot.com/?url=http%3A%2F%2Fwww.google.co.uk%2Fwebhp%3Fhl%3Den

but it is incomplete as it should have &name= infront with a user input value for that i need a second input

<input type="text" id="foo2" placeholder="Name here"/>

and say if the value 123456789 was input the output returned from the document.write should be http://link-ads.blogspot.com/?url=http%3A%2F%2Fwww.google.co.uk%2Fwebhp%3Fhl%3Den&name=123456789

0
Buni qo'shishni istagan narsa va unga biror narsa qo'shilsa, kiritilgan qiymati document.write "+ andnameinput +"
qo'shib qo'ydi muallif Yusaf Khaliq, manba
@Greg Ha, afsuski, men allaqachon bo'lmaganman.
qo'shib qo'ydi muallif Yusaf Khaliq, manba
@Greg tahrirni amalga oshirdi
qo'shib qo'ydi muallif Yusaf Khaliq, manba
Men faqat HTML CSS va juda kam javascriptni bilaman: (Afsuski, afsuski
qo'shib qo'ydi muallif Yusaf Khaliq, manba
Buning uchun nima uchun document.write ni ishlatasiz?
qo'shib qo'ydi muallif nnnnnn, manba
ikkinchi kirish qaerda?
qo'shib qo'ydi muallif Ibu, manba
Aslida, siz biror narsani qilishingizga to'g'ri kelmasligiga amin emasman, muammoni aniqroq tushuntira olasizmi yoki namuna qo'shishingiz mumkin
qo'shib qo'ydi muallif GregM, manba

1 javoblar

Agar siz yaxshi tushunsangiz, shunday bir narsa kerak:

<script type="text/javascript">
    function showMe(e) {
        paramencode = encodeURIComponent(e.value)
        document.getElementById('urlEncoded').innerHTML = document.getElementById('urlEncoded').innerHTML + 'http://link-ads.blogspot.com/?url='+paramencode;
    }
    function UpdateParam() {
        document.getElementById('urlEncoded').innerHTML = document.getElementById('urlEncoded').innerHTML + '&name='+ document.getElementById('foo2').value;
    }
</script>
<div id="urlEncoded"></div>
<input type="text" id="foo" placeholder="URL here" onchange="showMe(this)" />
<input type="text" id="foo2" placeholder="SecondParam" onchange="UpdateParam()" />
0
qo'shib qo'ydi
u ishlaydi, lekin muammo bor. Men birinchi kirishga biror narsa kiritganimda ikkinchi kirish panelini olib tashlaydi, shuning uchun hech narsa kiritish mumkin emas.
qo'shib qo'ydi muallif Yusaf Khaliq, manba
Ha, bu ishni bajarish uchun rahmat
qo'shib qo'ydi muallif Yusaf Khaliq, manba
Document.write-da ishonch hosil qiling
qo'shib qo'ydi muallif GregM, manba
bu sizning document.write uchun
qo'shib qo'ydi muallif GregM, manba
Ouplar xato qildilar, hozir ishlashlari kerak
qo'shib qo'ydi muallif GregM, manba
iltimos, to'g'ri javob sifatida rahmat
qo'shib qo'ydi muallif GregM, manba
Javascript UZB
Javascript UZB
99 ishtirokchilar

@js_uzb @vuejs_uz @react_uz @nodejs_uz @angular_uz @ngTashkent @yiiframework_uz @laravel_uz @linux_uzbek @python_uz @swift_uzb —————— @uzdevgroup @UzGeeksGroup ——— @UzDev_Jobs @jobs_uzb